public class Main {
    public static void main(String[] args) {
        MemoryManager memoryManager = new MemoryManager();

        // 分配内存
        memoryManager.allocateMemory(300);
        memoryManager.allocateMemory(500);
        memoryManager.allocateMemory(200);

        // 打印当前空闲分区情况
        System.out.println("空闲分区情况：");
        for (FreePartition partition : memoryManager.freePartitionList) {
            System.out.println("起始地址: " + partition.startAddress + ", 大小: " + partition.size + ", 已分配: " + partition.allocated);
        }

        // 回收内存
        memoryManager.deallocateMemory(0, 300);

        // 打印回收后的空闲分区情况
        System.out.println("\n回收后的空闲分区情况：");
        for (FreePartition partition : memoryManager.freePartitionList) {
            System.out.println("起始地址: " + partition.startAddress + ", 大小: " + partition.size + ", 已分配: " + partition.allocated);
        }
    }
}